<!doctype html>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@taglib uri="http://www.springframework.org/tags" prefix="spring"%>
<%@taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>

<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
		<title>Tendências de Faturamento - Ameaças</title>
		<%@ include file="head.jsp" %>
		
		<script type="text/javascript">
		
		  var _gaq = _gaq || [];
		  _gaq.push(['_setAccount', 'UA-35513738-1']);
		  _gaq.push(['_trackPageview']);
		
		  (function() {
		    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
		    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
		    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
		  })();
		
		</script>		
		
	</head>
<body>
	<%@ include file="menu.jsp" %>

    <div class="container-fluid">
    	<div class="row-fluid">
			
			<div class="page-header"><h1>Ameaças de Faturamento</h1></div>
			
			<c:if  test="${!empty declinios}">
				<table>
					<thead>
						<tr>
							<th>Nome</th>
							<th>Entidade</th>
							<th style="text-align: center; width: 70px">Data Inicial</th>
							<th style="text-align: center; width: 70px">Data Final</th>
							<th style="text-align: center;">Taxa de Declínio</th>
							<th style="width: 40px"></th>
						</tr>
					</thead> 
					<tbody>
						<c:forEach items="${declinios}" var="declinio" >
							<tr style="height: 40px">
								<td style="width: 200px;">${declinio.nome}</td>
								<td>${declinio.entidade.nome}</td>
								<td style="text-align: center;">${declinio.dataInicialFormatada}</td>
								<td style="text-align: center;">${declinio.dataFinalFormatada}</td>
								<td style="text-align: right;">${declinio.porcentagemFormatada}</td>
								<td style="text-align: center;"><img src="resources/img/excluir.gif" alt="Excluir" onclick="window.location.href='declinio/delete/${declinio.id}'" title="Excluir" style="cursor: pointer;"></td> 
							</tr>
						</c:forEach>
					</tbody>
				</table>
			</c:if>
			
			<c:if  test="${empty declinios}"><br/>Nenhum declinio cadastrado.<br/></c:if>
			
			<br/><br/>
			
			<div class="btn btn-primary btn-large" onclick="window.location.href='declinio/new'" >Nova Ameaça</div>

		</div>
		<%@ include file="rodape.jsp" %>
	</div>
</body>
</html>

